<!doctype html>
<html lang="en" class="fixed accounts sign-in" xmlns:th="http://www.w3.org/1999/xhtml">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>Sengled</title>
    <link rel="apple-touch-icon" sizes="120x120" th:href="@{/favicon/logosmall.ico}"/>
    <link rel="icon" type="image/png" sizes="192x192" th:href="@{/favicon/logosmall.ico}"/>
    <link rel="icon" type="image/png" sizes="32x32" th:href="@{/favicon/logosmall.ico}"/>
    <link rel="icon" type="image/png" sizes="16x16" th:href="@{/favicon/logosmall.ico}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/common/bootstrap.css}"/>
    <link rel="stylesheet" type="text/css" href="http://cdn.bootcss.com/font-awesome/4.6.0/css/font-awesome.min.css"/>
    <link rel="stylesheet" th:href="@{/css/common/animate.css}"/>
    <link rel="stylesheet" th:href="@{/css/style.css}"/>
    <link rel="stylesheet" th:href="@{/css/login.css}"/>
</head>

<body>

<div class="wrap">
    <div class="page-body animated slideInDown">
        <div class="logo">
            <h2>Sengled</h2>
        </div>
        <div class="box">
            <div class="panel mb-none">
                <div class="panel-content bg-scale-0">
                    <form name="loginForm" id="loginForm" action="login" method="POST">
                        <div class="form-group mt-md">
                            <span class="input-with-icon">
                                <input type="text" name="username" class="form-control" id="email" placeholder="Email"/>
                                <i class="fa fa-envelope"></i>
                            </span>
                            <p class="emailMsg">请输入正确的E-Mail地址</p>
                        </div>
                        <div class="form-group">
                            <span class="input-with-icon">
                                    <input type="password" name="password" class="form-control" id="password" placeholder="Password" />
                                    <i class="fa fa-key"></i>
                            </span>
                            <p class="passwordMsg">请输入正确的密码</p>

                        </div>

                        <div class="form-group">
                            <input type="submit">Sign in</input>
                        </div>
                        <!--<div class="form-group text-center">
                            <a href="pages_register.html" class="toRrg">Registered account</a>
                            <a href="pages_forgot-password.html" class="toFor">Forgot password?</a>
                        </div>-->
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/js/lib/jquery.min.js}"></script>
<script th:src="@{/js/lib/bootstrap.min.js}"></script>
<script th:src="@{/js/lib/nano-scroller.js}"></script>
<script>
    /*<![CDATA[*/
    $(function () {
        $('.emailMsg').css('display','none');
        $('.passwordMsg').css('display','none');

        //免输入
        $('#email').val("test@sengled.com");
        $('#password').val("123456");

        $('#email').on('keyup',function () {
            if( this.value=="" || ( this.value!="" && !/.+@.+\.[a-zA-Z]{2,4}$/.test(this.value) ) ){
                $('.emailMsg').css('display','block')

            }else {
                $('.emailMsg').css('display','none')
            }
        });

        $('#password').on('keyup',function () {
            if( this.value=="" || this.value.length < 6){
                $('.passwordMsg').css('display','block')

            }else {
                $('.passwordMsg').css('display','none')
            }
        });

        $('#signIn').on('click',function () {

            var $email=$('#email').val();
            var $password=$('#password').val();

            console.log($email)
            console.log($password)
            $('#loginForm').submit();
        })

        document.onkeydown=function () {
            if(event.keyCode==13) {
                //成功跳转 index.html
                $('#loginForm').submit();
            }
        }

        

    })

    /*]]>*/
</script>

</body>

</html>
